/**
* Copyright (c) 2007,中企动力华南研发中心
* All rights reserved.
*/

package com.ce.pms.custservice.dao;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import junit.framework.Assert;

import org.junit.Test;

import com.ce.pms.DBUnitTool;
import com.ce.pms.custservice.vo.CheckRecordVO;
import com.sitechasia.webx.core.support.Page;

/**
 * @author 高嵩 编写日期:2008-12-18
 *	抽检dao测试类
 */
public class CheckRecordDaoImplT extends DBUnitTool{

	private ICheckRecordDao checkRecordDao =  null;
	/* (non-Javadoc)
	 * @see com.ce.pms.DBUnitTool#setUp()
	 */
	@Override
	public void setUp() throws Exception {
		// TODO Auto-generated method stub
		super.setUp();
		initCustServiceEventDao();
	}

	private void initCustServiceEventDao(){
		if (this.checkRecordDao==null) {
			this.checkRecordDao = (ICheckRecordDao)this.applicationContext.getBean("checkRecordDao");
		}
		assertNotNull(checkRecordDao);
	}

	/* (non-Javadoc)
	 * @see com.ce.pms.DBUnitTool#tearDown()
	 */
	@Override
	public void tearDown() throws Exception {
		// TODO Auto-generated method stub
		super.tearDown();
		checkRecordDao =  null;
	}


	/***
	    * 功能描述:  测试分页查询抽检登记<br>
	    * Create author:高嵩 <br>
	    * Create on:2008-12-23  <br>
	    * Edit author:  <br>
	    * Edit on:    <br>
	    * Why:     <br>
	    */
	@Test
	public void testQueryCheckRecordByPage() {
		CheckRecordVO checkRecordVO = new CheckRecordVO();
		checkRecordVO.setPageNo(new Integer(1));
		checkRecordVO.setPageSize(new Integer(3));
		Page pageResult = checkRecordDao.queryCheckRecordByPage(checkRecordVO);
		Assert.assertNotNull(pageResult);
		Assert.assertEquals(pageResult.getResult().size(), 3);

		assertEquals(pageResult.getCurrentPageNo(), 1);
		assertEquals(pageResult.getTotalCount(), 3);
		assertEquals(pageResult.getTotalPageCount(), 1);
	}
}
